<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<title id="title">修德抄经堂</title>
	<link rel="stylesheet" type="text/css" href="../bower_components/mui/dist/css/mui.css">
	<link rel="stylesheet" type="text/css" href="../css/yinshua.css">
	<link rel="stylesheet" type="text/css" href="../css/base.css">
	<link rel="stylesheet" type="text/css" href="../css/full.css">
	<script src="../bower_components/mui/dist/js/mui.min.js"></script>
	<script src="../bower_components/jquery/dist/jquery.js"></script>
</head>

<body>
	<div id="mcover1">
		<div>
			<div id="xian">
				<p>经书未收藏！</p>
				<button>确认</button>
			</div>
		</div>
	</div>
	<div class="page">
		<div class="jingshu_name">
			<p class="same color" id="">
				<span id="sutraName">《心经》王羲之行书本</span>
				<br>
				<span style="font-size: 18px;" class="fang">
					<span id="finishTime"></span>完成
				</span>
			</p>
		</div>

		<div class="table">
			<table id="historyTable">
					<tr class="b_title color same" align="left">
						<td>时间</td>
						<td>地点</td>
						<td align="center" width="40">数量</td>
					</tr>
			</table>
		</div>
		<a href="bushi.html">
			<p id="fanhui" class="fang">返回</p>
		</a>
	</div>
</body>
<script src="../bower_components/mui/dist/js/mui.min.js"></script>
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../js/common.js"></script>
<script>
    function formatTime(timeStr) {
        if (!timeStr) {
            return "未";
        }

        var date = parseISODate(timeStr);
        return date.getFullYear() + "." + (date.getMonth() + 1) + "." + date.getDate()
    }
	$(function () {
		var userTranscriptionID = localStorage.getItem('userTranscriptionID');
		var csrftoken = getCookie('csrftoken');

		$.ajax({
			url: '/fe/print/user_transcription/' + userTranscriptionID + '/donate_history',
			method: "GET",
			beforeSend: function (xhr, settings) {
				xhr.setRequestHeader("X-CSRFToken", csrftoken);
			},
			success: function (data) {
				if (data.status == '200'){
					$("#sutraName").text(data.data.sutra_edition_name);
				$("#finishTime").text(formatTime(data.data.transcription_finish_time));
				var historyList = data.data.history;
				var html = "";
				for (var i = 0; i < historyList.length; i++) {
					var history = historyList[i];
					html +=
						'<tr class="color fang">' +
							'<td>' + formatTime(history.time) + '</td>' +
							'<td>' + history.temple_name + '</td>' +
							'<td align="center" width="40">' + history.num + '本</td>' +
						'</tr>';
				}
				$("#historyTable").append(html);
				}
				else $("#mcover1").css("display","block");
			},
		});
	});
	$("#xian button").click(function () {
            history.back();
        })
</script>

</html>